// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 账号登录验证 Sample request:
            
    Account
    {
       "username": "admin",
       "password": "21232f297a57a5a743894a0e4a801fc3",
       "type": "account",
       "autoLogin": true
    }
    
    Mobile
    {
       "mobile": "18328408303",
       "captcha": "1234",
       "type": "mobile",
       "autoLogin": true
    } POST /api/login/account */
export async function postApiLoginAccount(body: API.LoginParams, options?: { [key: string]: any }) {
  return request<API.SimpleResultLoginResult>('/api/login/account', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 双因素验证 POST /api/login/account/two-factor-verify */
export async function postApiLoginAccountTwoFactorVerify(
  body: API.TwoFactorVerifyParams,
  options?: { [key: string]: any },
) {
  return request<API.NotDataResult>('/api/login/account/two-factor-verify', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取验证码 GET /api/captcha */
export async function getApiCaptcha(
  params: {
    // query
    phone?: string;
  },
  options?: { [key: string]: any },
) {
  return request<API.NotDataResult>('/api/captcha', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 刷新当前登录用户 GET /api/currentUser/refresh */
export async function getApiCurrentUserRefresh(options?: { [key: string]: any }) {
  return request<API.NotDataResult>('/api/currentUser/refresh', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取当前登录用户 GET /api/currentUser */
export async function getApiCurrentUser(options?: { [key: string]: any }) {
  return request<API.SimpleResultUserSession>('/api/currentUser', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取当前账号配置信息 GET /api/account/settings */
export async function getApiAccountSettings(options?: { [key: string]: any }) {
  return request<API.SimpleResultAccountSettingsDto>('/api/account/settings', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 更新账号基本信息 POST /api/account/settings */
export async function postApiAccountSettings(
  body: API.AccountSettingsModifyDto,
  options?: { [key: string]: any },
) {
  return request<API.NotDataResult>('/api/account/settings', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取账号安全设置信息 GET /api/account/settings/security */
export async function getApiAccountSettingsSecurity(options?: { [key: string]: any }) {
  return request<API.SimpleResultAccountSecurityDto>('/api/account/settings/security', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 修改密码 POST /api/account/settings/change-password */
export async function postApiAccountSettingsChangePassword(
  body: API.UserPasswordChangeDto,
  options?: { [key: string]: any },
) {
  return request<API.NotDataResult>('/api/account/settings/change-password', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 账号设置值检查 GET /api/account/settings/valueCheck */
export async function getApiAccountSettingsValueCheck(
  params: {
    // query
    fieldName?: string;
    fieldValue?: string;
  },
  options?: { [key: string]: any },
) {
  return request<API.NotDataResult>('/api/account/settings/valueCheck', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 登出当前用户 POST /api/logout */
export async function postApiLogout(options?: { [key: string]: any }) {
  return request<API.NotDataResult>('/api/logout', {
    method: 'POST',
    ...(options || {}),
  });
}
